import { createApp } from "vue";

import App from "./App.vue";
// 路由
import router from "./router/index.js";
//配置 element
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
//配置 element icon
import * as ElementPlusIconsVue from "@element-plus/icons-vue";
// pinia
import { createPinia } from "pinia";
// ECharts
import ECharts from "vue-echarts";
import * as echarts from "echarts";
import zhCn from "element-plus/es/locale/lang/zh-cn";
// 引入模板的全局样式
import "./styles/index.less";
import i18n from "./i18n/index.js";
const app = createApp(App);
// 全局注册图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}
// 创建 Pinia 实例
const pinia = createPinia();
app.use(createPinia());
app.use(router);
app.use(i18n);
app.use(ElementPlus, {
  locale: zhCn,
});
app.use(pinia);
app.component("v-chart", ECharts);
app.config.globalProperties.$echarts = echarts; // 全局挂载 ECharts
app.mount("#app");
